#include "drve_led.h"
#include "drv_systick.h"
#include "drv_beep.h"
#include "drv_key.h"
static uint8_t key_status1=0;
static uint8_t key_status2=0;
static uint8_t key_status3=0;
static uint8_t key_statusu=0;
int main (void)
{    
	drv_systick_init(168);
	drve_led_int_u();
	drve_led_int1();
	drve_led_int2();
	drve_led_int3();
	drv_key_int_u();
	drv_key_int1();
	drv_key_int2();
	drv_key_int3();
	beep_init();
	
	while(1)
	{
	 if(drv_get_key1())
	 	{
	 	  key_status1=~key_status1;
	 	}
	 if(key_status1)
	 	{
	 	 //beep_on();
		 drve_led_open1();
		 drv_systick_ms(1000);
         drve_led_close1();
		 drv_systick_ms(1000);
	 	}
	else
	{
		beep_off();
		drve_led_close1();
	}
	 if(drv_get_key_u())
	 	{
	 	  key_statusu=~key_statusu;
	 	}
	 if(key_statusu)
	 	{
	 	 
		 // beep_on();
		 drve_led_open_u();
		 drv_systick_ms(1000);
         drve_led_close_u();
         drv_systick_ms(1000);
	 	}
	else
	{
		beep_off();
		drve_led_close_u();
	}
	 if(drv_get_key2())
	 	{
	 	  key_status2=~key_status2;
	 	}
	 if(key_status2)
	 	{
	 	
		 // beep_on();
		 drve_led_open1();
		 drv_systick_ms(1000);
         drve_led_close1();
        drv_systick_ms(1000);
			drve_led_open2();
		 drv_systick_ms(1000);
         drve_led_close2();
        drv_systick_ms(1000);
			drve_led_open3();
		 drv_systick_ms(1000);
         drve_led_close3();
        drv_systick_ms(1000);
	 	}
	else
	{
		beep_off();
		drve_led_close2();
	}
	 if(drv_get_key3())
	 	{
	 	  key_status3=~key_status3;
	 	}
	 if(key_status3)
	 	{
		 // beep_on();
		 drve_led_open3();
		 drv_systick_ms(1000);
         drve_led_close3();
		 drv_systick_ms(1000);
	 	}
	else
	{
		beep_off();
		drve_led_close3();
	}
	}
}


